package com.yctan.base.entity;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.hibernate.validator.constraints.NotBlank;

/**
 * 供应商登陆表
 */
public class Admin extends BaseEntity {
    private String nickname;        //昵称*

    private String username;        //账号

    private String password;        //密码*

    private String salt;            //盐值*

    private String headPortrait;    //头像*

    private Supplier supplier;    //供应商

    private Integer userType;    //账户类型，0管理员，1经销商,2经销商下级

    public static final Integer type_admin = 0;
    public static final Integer type_dealer = 1;
    public static final Integer type_staff = 2;

    //查询条件
    private String oldPassword;     //旧密码

    public Admin() {
    }

    public Admin(Supplier supplier) {
        this.supplier = supplier;
    }

    @NotBlank(message = "昵称不能为空")
    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    @JsonIgnore
    public String getPassword() {
        return password;
    }

    @JsonProperty
    public void setPassword(String password) {
        this.password = password;
    }

    @JsonIgnore
    public String getSalt() {
        return salt;
    }

    public void setSalt(String salt) {
        this.salt = salt;
    }

    @NotBlank(message = "头像不能为空")
    public String getHeadPortrait() {
        return headPortrait;
    }

    public void setHeadPortrait(String headPortrait) {
        this.headPortrait = headPortrait;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public Supplier getSupplier() {
        return supplier;
    }

    public void setSupplier(Supplier supplier) {
        this.supplier = supplier;
    }

    public Integer getUserType() {
        return userType;
    }

    public void setUserType(Integer userType) {
        this.userType = userType;
    }

    @JsonIgnore
    public String getOldPassword() {
        return oldPassword;
    }

    @JsonProperty
    public void setOldPassword(String oldPassword) {
        this.oldPassword = oldPassword;
    }
}